package com.ang.propagation.t3;

import com.ang.propagation.t2.NewService2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Component
public class NestedService2 {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Transactional(propagation = Propagation.NESTED)
    public void update() {
        jdbcTemplate.update("update t_user set age = ? where id = ?", 1, 2);
//        int i = 1 / 0;
    }
}
